/*******************************************
 *                                         *
 *******************************************/

#ifndef SPRITE_H
#define SPRITE_H

//Link DLL
#pragma comment (lib, "d3d9.lib")

//Include DirectX Headers
#include <d3d9.h>
#include "..\Helpers.h"

#define SPRITE_FVF (D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1)

namespace DirectXFramework
{
	namespace Graphics
	{
		//SpritePoint Struct Definition
		struct SpritePoint
		{
			float X, Y, Z, RHW;
			DWORD Color;
			float U, V;

			SpritePoint (void) { }
			SpritePoint (float x, float y, float z, float rhw, DWORD color, float u, float v)
			{  X = x;  Y = y;  Z = z;  RHW = rhw;  Color = color;  U = u;  V = v;  }
		};

		//Sprite Class Declaration
		class Sprite
		{
			public:
				//Constructors
				Sprite (void);
				Sprite (LPDIRECT3DDEVICE9 DrawDevice, float SpriteWidth, float SpriteHeight, float SpriteDepth);
				//Destructor
				~Sprite (void);

				//Public Methods
				BOOL Init (LPDIRECT3DDEVICE9 DrawDevice, float SpriteWidth, float SpriteHeight, float SpriteDepth);
				BOOL LoadTexture (LPCTSTR File);
				void Draw (void);
				
				//Setters
				void SetLocation (float XLoc, float YLoc);

			private:
				//Private Methods
				void CreateQuad (void);

				//Private Members
				SpritePoint* Quad;
				float XLocation, YLocation;
				float Width, Height, Depth;
				LPDIRECT3DDEVICE9 Device;
				LPDIRECT3DTEXTURE9 Texture;
		};

		//Create Pointer Variable
		typedef Sprite* LPSPRITE;
	};
};

#endif